<?php
/**
 * Created by PhpStorm.
 * User: wangkk
 * Date: 2019-03-20 14:29
 * Description: {卡券货架模型}
 */

namespace app\models;
use yii\db\ActiveRecord;

class CardPageForm extends ActiveRecord{
    //public $id;
    //public $cardpage_name;  //卡券货架名称
    public $banner;         //页面banner图地址
    public $page_title;     //页面title
    public $can_share;      //页面是否可以分享
    public $scene;          //投放页面场景值
    public $card_id;        //页面投放的卡券id，支持多个，逗号隔开
    public $thumb_url;      //卡券的缩略图地址，每个card_id对应一个缩略图，多个，逗号隔开

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'wx_cardpage';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return array(
            array(
                array(
                    'cardpage_name', 'banner', 'page_title', 'can_share', 'card_id', 'thumb_url'
                ),
                'required'
            ),
        );
    }

    //设置label
    public function attributeLabels()
    {
        return [
            'cardpage_name' => '卡券货架名称（自定义）',
            'banner'        => '页面banner图地址',
            'page_title'    => '页面title内容',
            'can_share'     => '页面是否允许分享',
            'scene'         => '投放页面场景值',
            'card_id'       => '卡券批次card_id',
            'thumb_url'     => '卡券缩略图地址',
            'page_id'       => '货架ID',
            'page_url'      => '货架页面地址',
        ];
    }

    public static function find()
    {
        return new CardPageQuery(get_called_class());
    }

}